<script setup>
import { menuOptions, routesIndexArr } from "./router/config.js";
import { Icon } from "@arco-design/web-vue";

const IconFont = Icon.addFromIconFontCn({ src: "https://at.alicdn.com/t/font_180975_ue66sq60vyd.js" });

console.log(routesIndexArr);
</script>

<template>
  <div class="app-container">
    <a-menu
      :style="{ width: '200px', height: '100%' }"
      :default-open-keys="['10']"
      :default-selected-keys="[routesIndexArr['10'][0].en]"
      show-collapse-button
      breakpoint="xl"
    >
      <a-sub-menu v-for="key in Object.keys(routesIndexArr)" :key="key" :title="menuOptions[key].name">
        <template #icon>
          <icon-font type="icon-person" />
        </template>
        <a-menu-item v-for="item in routesIndexArr[key]" :key="item.en">{{ item.cn }}</a-menu-item>
      </a-sub-menu>
    </a-menu>
    <div class="main-container">
      <h3 class="title-container">{{ $route.meta.title }} - {{ $route.name }}</h3>
      <div class="component-container">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.app-container {
  width: 100vw;
  height: 100vh;
  display: flex;

  .main-container {
    flex: 1;
    height: 100%;
    background-color: #e5e6eb;

    display: flex;
    flex-direction: column;

    .title-container {
      margin: 10px;
      background-color: #fff;
      padding: 15px 10px;
    }

    .component-container {
      flex: 1;
      margin: 0 10px 10px;
      background-color: #fff;
      padding: 10px;
      overflow: auto;
    }
  }
}
</style>
<style>
.container {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
